package com.wicketFlowTester.framework;

import org.apache.wicket.Component;
import org.apache.wicket.Page;
import org.apache.wicket.behavior.AbstractAjaxBehavior;
import org.apache.wicket.protocol.http.mock.MockHttpServletRequest;

/**
 * Facade over wicket tester
 * @author Kumar Rohit
 */
public interface WicketTesterFacade {
    
    /** Start the web application and render the page.
     * @param webApplication
     * @return
     */
    Page startPage(Page page);
    
    /**
     * Returns the last rendered page.
     * @return
     */
    Page getLastRenderedPage();
    
    /**
     * execute the underlying ajax event attached to the component.
     * @param component
     * @param event
     */
    void executeAjaxEvent(Component component, String event);

    /**
     * Return the component from the Last Rendered Page.
     * @param path
     * @return
     */
    Component getComponentFromLastRenderedPage(String path);
    
    /**
     * Returns the form tester adaptor.
     * @param path
     * @return
     */
    FormTesterFacade newFormTester(String path);

    /**
     * execute the Ajax behavior. 
     * @param behavior
     */
    void executeBehavior(AbstractAjaxBehavior behavior);

    /**
     * returns the servlet request.
     * @return
     */
    MockHttpServletRequest getRequest();
}
